﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <link rel="stylesheet" href="dojo/dijit/themes/claro/claro.css"/>
    <script src='dojo/dojo/dojo.js'></script>
    <script>
        require([
    "dojo/_base/declare", "dojo/dom-construct", "dojo/parser", "dojo/ready",
    "dijit/_WidgetBase",
        ], function (declare, domConstruct, parser, ready, _WidgetBase) {
            declare("Counter", [_WidgetBase], {
                // counter
                _i: 0,

                buildRendering: function () {
                  
                    this.domNode = domConstruct.create("button", { innerHTML: this._i });
                },

                postCreate: function () {
                    // every time the user clicks the button, increment the counter
                    this.connect(this.domNode, "onclick", "increment");
                },

                increment: function () {
                    this.domNode.innerHTML = ++this._i;
                }
            });

            ready(function () {
                // Call the parser manually so it runs after our widget is defined, and page has finished loading
                parser.parse();
            });
        });

    </script>
</head>
<body>
    <span data-dojo-type="Counter">最简单的非行为性小部件</span>
</body>
</html>
